package com.cl.short_video_java.web.common;

import cn.hutool.core.codec.Base64Encoder;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.map.MapUtil;
import com.cl.short_video_java.annotation.NoRepeatSubmit;
import com.cl.short_video_java.common.Result;
import com.cl.short_video_java.service.CommonService;
import com.cl.short_video_java.util.RedisUtil;
import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.ByteArrayOutputStream;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * @Author 付
 * @Date 2024-11-01 16:55
 * @Version 1.0
 * @description
 * @since 1.0
 */
@RestController
@RequestMapping("/common")
public class CommonController {


	@Autowired
	CommonService commonService;

	@GetMapping("/captcha")
	// 1s1次
	@NoRepeatSubmit(lockTime = 1)
	public Result getCaptcha() {
		Map<String, String> map = commonService.captcha();
		return Result.success(map);
	}
}
